package com.scut.filedownloader;

import android.app.Application;

import com.scut.filedownloader.core.recorder.RecorderFactory;

/**
 * 全局类，用于存储一些全局变量
 */
public class FileDownloader extends Application {

    public static FileDownloader app;
    public String downloadEntryRecordName="download_entries"; //描述下载记录的xml文件名
    public String downloadRecordName="download_task_"; // "download_task_id"为对应下载项的xml文件
    public String defaultDownloadDirectory="/storage/emulated/0/Download";
    public String defaultExternalStoragePath="/storage/emulated/0";
    public int CONNECTION_TIMEOUT_MILLISECOND=5000;

    public static FileDownloader getInstance(){
        return app;
    }
    private RecorderFactory recorderFactory=null;

    @Override
    public void onCreate() {
        app=this;
        super.onCreate();
    }

    /**
     * 下载条目记录器对象工厂类获取接口
     * @return 记录器工厂类对象
     */
    public RecorderFactory getRecorderFactory(){
        if(recorderFactory==null){
            recorderFactory=new RecorderFactory(this);
        }
        return recorderFactory;
    }

}
